package de.hsf.bp.netdoc.gui;

import java.awt.Container;
import java.awt.Graphics;
import java.awt.Image;

import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;

import de.hsf.bp.netdoc.Controller;

import java.awt.Font;

import javax.swing.SwingConstants;
import javax.swing.ImageIcon;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Dimension;
import java.io.File;
import java.io.IOException;

public class StartPage extends JPanel implements CardNames{
	private Container c;	// ContentPane
	
	GuiView myGUI;
	
	public void paintComponent(Graphics g){
	     try {
	          Image img = ImageIO.read(new File("bg.jpg"));
	          g.drawImage(img, 0, 0, this);
	          g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
	        } catch (IOException e) {
	          e.printStackTrace();
	          }
	        } 

	/**
	 * Create the panel.
	 * @param myController 
	 */
	public StartPage(GuiView gui) {
		
		myGUI = gui;
		setLayout(null);
		
		JLabel lblTitle = new JLabel("Tool zur Netzwerkdokumentation");
		lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
		lblTitle.setFont(new Font("Tahoma", Font.BOLD, 40));
		lblTitle.setBounds(10, 11, 863, 150);
		add(lblTitle);
		
		JButton btnGoHard = new JButton("Hardware Archievierung");
		btnGoHard.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				myGUI.changePanel(HARD);
			}
		});
		btnGoHard.setFont(new Font("Tahoma", Font.BOLD, 15));
		btnGoHard.setBounds(10, 374, 220, 100);
		add(btnGoHard);
		
		JButton btnGoSoft = new JButton("Software Archivierung");
		btnGoSoft.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				myGUI.changePanel(SOFT);
			}
		});
		btnGoSoft.setFont(new Font("Tahoma", Font.BOLD, 15));
		btnGoSoft.setBounds(663, 374, 220, 100);
		add(btnGoSoft);
		
		JButton btnGoDoc = new JButton("Netzwerkdokumentation Aufbauen");
		btnGoDoc.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				myGUI.changePanel(DOCU);
				
			}
		});
		btnGoDoc.setFont(new Font("Tahoma", Font.BOLD, 15));
		btnGoDoc.setBounds(266, 192, 335, 100);
		add(btnGoDoc);
		
		JButton btnGoNot = new JButton("Notfall-Plan");
		btnGoNot.addActionListener(new ActionListener() {
			
			public void actionPerformed(ActionEvent e) {
				myGUI.changePanel(NOTFALL);
			}
		});
		btnGoNot.setFont(new Font("Tahoma", Font.BOLD, 15));
		btnGoNot.setBounds(10, 192, 160, 100);
		add(btnGoNot);
		
		JButton btnGoAdmin = new JButton("Administration");
		btnGoAdmin.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				myGUI.changePanel(ADMIN);
			}
		});
		btnGoAdmin.setFont(new Font("Tahoma", Font.BOLD, 15));
		btnGoAdmin.setBounds(703, 192, 180, 100);
		add(btnGoAdmin);
		
		JButton btnGoLisenz = new JButton("Lisenzverwahltung");
		btnGoLisenz.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				myGUI.changePanel(LIZENZ);
			}
		});
		btnGoLisenz.setFont(new Font("Tahoma", Font.BOLD, 15));
		btnGoLisenz.setBounds(337, 377, 220, 95);
		add(btnGoLisenz);

	}

}
